package com.zz.common.utils.common;

import com.fasterxml.uuid.EthernetAddress;
import com.fasterxml.uuid.Generators;
import com.fasterxml.uuid.impl.TimeBasedGenerator;

/**
 * @author zl
 * @version 1.0
 */
public class UUIDGenerator {
    private static TimeBasedGenerator timeBasedGenerator;

    static {
        EthernetAddress ethernetAddress = EthernetAddress.fromInterface();
        timeBasedGenerator = Generators.timeBasedGenerator(ethernetAddress);
    }

    public static String generateUUID() {
        String uuidWithHyphens = timeBasedGenerator.generate().toString();
        return uuidWithHyphens.replaceAll("-", "");
    }
}
